import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

Vue.config.productionTip = false

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import locale from 'element-ui/lib/locale/lang/en' // lang i18n
// 防止页面左右晃动
ElementUI.Dialog.props.lockScroll.default = false
// 轮播图插件
import 'swiper/css/swiper.css'
import '@/styles/index.scss' // global css
import * as echarts from 'echarts'
Vue.prototype.$echarts = echarts

// dayjs插件
import dayjs from 'dayjs'
Vue.prototype.$dayjs = dayjs

Vue.use(ElementUI, {
  locale
})

// socket.io
import VueSocketIO from 'vue-socket.io'
Vue.use(new VueSocketIO({
  debug: true, // 测试的时候打开
  connection: 'http://175.178.236.203:3023',
  options: { // Optional options,
    autoConnect: false
    // autoConnect 通常与 this.$socket.connect()结合使用，表示手动连接socket服务器
  }

}))

import '@/permission'

if (process.env.NODE_ENV === 'production') {
  const { mockXHR } = require('../mock')
  mockXHR()
}

// 组件注册
import Carousel from '@/components/Carousel'
Vue.component(Carousel.name, Carousel)
import ClassModel from '@/components/ClassModel'
Vue.component(ClassModel.name, ClassModel)
import BoxBorder from '@/components/BoxBorder'
Vue.component(BoxBorder.name, BoxBorder)

// 引入全局的API
import API from '@/api'
new Vue({
  beforeCreate() {
    Vue.prototype.$bus = new Vue()
    Vue.prototype.$API = API
  },
  router,
  store,
  render: (h) => h(App)
}).$mount('#app')
